function myInstanceof(obj, constructor) {
  let proto = Object.getPrototypeOf(obj)
  while (proto) {
    if (proto === constructor.prototype) return true
    proto = Object.getPrototypeOf(proto)
  }
  return false

}


const a = []

console.log(myInstanceof(a,Array))
console.log(myInstanceof(Array,Object))